package com.gitee.secretopen.plugin.config;

import java.io.File;

/**
 * 　@description: 配置类
 * 　@author secret
 * 　@date 2021/1/30 18:41
 *
 */
public class SecretPluginConfig {
    private boolean useFile=false;//是否输出插件配置文件
    private String pluginJsonPath="config"+ File.separator+"plugins.json";//默认插件json配置文件输出目录
    private static SecretPluginConfig instance;

    /**
     * 私有化，只允许单例初始化,配置之后不可修改
     */
    private SecretPluginConfig(){
    }

    private SecretPluginConfig(boolean useFile){
        this.useFile=true;
    }


    public static SecretPluginConfig getInstance(boolean useFile){
        if(instance==null){
            instance = new SecretPluginConfig(useFile);
        }
        return instance;
    }

    public static SecretPluginConfig getInstance(){
        if(instance==null){
            instance = new SecretPluginConfig();
        }
        return instance;
    }

    public boolean isUseFile() {
        return useFile;
    }

    public String getPluginJsonPath() {
        return pluginJsonPath;
    }

    public void setPluginJsonPath(String pluginJsonPath) {
        this.pluginJsonPath = pluginJsonPath;
    }
}
